// 获取合约实例，导出去

// 引入web3
let Web3 = require('web3');
// 实例化
let web3 = new Web3;
// 设置网络
web3.setProvider('http://localhost:7545');

let abi = [{"constant":true,"inputs":[],"name":"getValue","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_str","type":"string"}],"name":"setValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_str","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}];
let address = '0x8a6d4dEA4c5b32165FF7b7cb3aeBF12524f21110';

// 此处abi已经是json对象，不需要进行parse动作
let contractInstance = new web3.eth.Contract(abi,address);
console.log('address:',contractInstance.options.address);

module.exports = contractInstance;